package health.lm.com.shop.presenter;

import java.util.ArrayList;
import java.util.List;

import health.lm.com.component_base.base.callback.Callback;
import health.lm.com.component_base.base.mvp.contract.XPresent;
import health.lm.com.network.callback.SimpleCallBack;
import health.lm.com.shop.activity.HLAllCompanyActivity;
import health.lm.com.shop.entity.BusinessListEntity;
import health.lm.com.shop.entity.HLAllCompanyEntity;
import health.lm.com.shop.model.MallModel;

/**
 * Created by Android Studio .
 * Project：hlian health.lm.com.shop.presenter
 * Date：2019/8/13 14:56
 * Introduce：全部商会/影响力中心
 */
public class HLAllCompanyPresenter extends XPresent<HLAllCompanyActivity> {
    public void getBusinessListData(int page, int pageSize) {
        MallModel.getInstance().getBusinessListData(page, pageSize, new SimpleCallBack<BusinessListEntity>() {
            @Override
            public void onSuccess(BusinessListEntity pBusinessListEntity) {
                if (hasV()) getV().setNewData(pBusinessListEntity.getList());
            }
        });
    }

    public void getInfluenceCenterData(int page, int pageSize) {
        MallModel.getInstance().getInfluenceCenterData(page, pageSize, new SimpleCallBack<BusinessListEntity>() {
            @Override
            public void onSuccess(BusinessListEntity pBusinessListEntity) {
                if (hasV()) getV().setNewData(pBusinessListEntity.getList());
            }
        });
    }

    /**
     * 关注
     *
     * @param id 商会Id
     */
    public void attention(String id, Callback pCallback) {
        List<String> follow_id = new ArrayList<>();
        follow_id.add(id);
        MallModel.getInstance().attention(follow_id, 2, new SimpleCallBack<Object>() {
            @Override
            public void onSuccess(Object pO) {
                pCallback.callback("");
            }
        });
    }

    private List<HLAllCompanyEntity> getResource() {
        List<HLAllCompanyEntity> entityList = new ArrayList<>();
        for (int a = 0; a < 10; a++) {
            HLAllCompanyEntity companyEntity = new HLAllCompanyEntity();
            companyEntity.setCompany_image("http://image109.360doc.com/DownloadImg/2018/03/1008/126782666_1_2018031008485635.jpeg");
            companyEntity.setCompany_name("会链研究院");
            companyEntity.setAttention(a % 2 == 0 ? "1" : "0");
            companyEntity.setChairman("乔布斯");
            companyEntity.setId("" + a);
            companyEntity.setMember("1200人");
            companyEntity.setPhone("13112345678");
            companyEntity.setAddress("山东省临沂市姑苏站路418号10层");
            entityList.add(companyEntity);
        }

        return entityList;
    }
}
